import { setVideoData } from '@/utils/video.js'
const state = {
  url: null, //  视频播放地址
  thumb: false,
  title: null,
}
const mutations = {
  SET_URL(state, url) {
    state.url = url
  },
  SET_THUMB(state, thumb) {
    state.thumb = thumb
  },
  SET_TITLE(state, title) {
    state.title = title
  },
}

const actions = {
  setData({ commit }, data) {
    setVideoData(data)
    commit('SET_URL', data.url)
    commit('SET_THUMB', data.thumb)
    commit('SET_TITLE', data.title)
  },
}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
}
